/*
 * vision.h
 *
 *  Created on: Oct 1, 2014
 *      Author: amorim
 */

#ifndef VISION_H_
#define VISION_H_

#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <cv.h>
#include <highgui.h>
#include <iostream>
#include "opencv2/imgproc/imgproc.hpp"
#include "cmucam.h"


using namespace cv;
using namespace std;

#define EYE_Y(IMG) IMG.size().height-15
#define EYE_X(IMG) IMG.size().width/2

#define R 100
#define G 250
#define B 250

class TheEye{

	string path;
	string name;


	CMUCam eye;
	Mat currentImg;

public:

	TheEye();
	/**
	 * Measures free space in front of the robot
	 * Based on floor detection technique using
	 * the currentImg
	 */
	int free_space(Mat src, Mat flooded);

	int free_space2(Mat src, Mat flooded); // uses the edges technique

	void update(); // updates currente IMG

	void edge_detection(Mat src, Mat dest, double th); // detects edges from src into dest

	void save_current_img(string file);

	int flood_fill(Mat dest, int x, int y);

	void set_current_img(Mat img);

	Mat get_current_img();
};



#endif /* VISION_H_ */
